home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / rhstdlib.arc / STRCPYL.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-10-20  |  940 b   |  64 lines

  1. stdlib        segment    para public 'slcode'
  2.         assume    cs:stdlib
  3. ;
  4. ;
  5. ; strcpyl- Copies string pointed at by cs:rtnadrs to es:di.
  6. ;
  7. ;
  8. ; inputs:
  9. ;        cs:rtn-    Zero-terminated source string.
  10. ;        es:di-  Buffer for destination string.
  11. ; outputs:
  12. ;        es:di-    Still points at destination string.
  13. ;
  14. ;
  15. ; Note: The destination buffer must be large enough to hold the string and
  16. ;    zero terminating byte.
  17. ;
  18.         public    sl_strcpyl
  19. ;
  20. rtnadrs        equ    6[bp]
  21. destptr        equ    2[bp]
  22. ;
  23. sl_strcpyl    proc    far
  24.         push    es
  25.         push    di
  26.         push    bp
  27.         mov    bp, sp
  28.         push    ds
  29.         push    cx
  30.         push    ax
  31.         pushf
  32.         push    si
  33. ;
  34.         cld
  35.         mov    al, 0
  36.         mov    cx, 0ffffh
  37.         les    di, rtnadrs
  38.     repne    scasb
  39.         lds    si, rtnadrs
  40.         mov    rtnadrs, di
  41.         les    di, destptr
  42.         neg    cx
  43.         dec    cx
  44.         shr    cx, 1
  45.         jnc    CpyWrd
  46.         lodsb
  47.         stosb
  48. CpyWrd:    rep    movsw
  49. ;
  50. DidByte:    pop    si
  51.         popf
  52.         pop    ax
  53.         pop    cx
  54.         pop    ds
  55.         pop    bp
  56.         pop    di
  57.         pop    es
  58.         ret
  59. sl_strcpyl    endp
  60. ;
  61. ;
  62. stdlib        ends
  63.         end
  64.